import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { Logger } from '@nestjs/common';

async function bootstrap() {
  if (process.env.TRANSPORT === 'SSE') {
    const app = await NestFactory.create(AppModule);

    await app.listen(process.env.PORT ?? 3000, () => {
      Logger.log(`Server listening on port ${process.env.PORT ?? 3000}`);
    });
  } else {
    const app = await NestFactory.createApplicationContext(AppModule, {
      // logger: false
    });
    return app.close();
  }
}
void bootstrap();
